
package jweslley.ContestVolumes.VolumeCI;

import static java.lang.Math.abs;
import static java.util.Collections.binarySearch;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;

import jweslley.Problem;
import jweslley.Problem.Status;

/**
 * http://icpcres.ecs.baylor.edu/onlinejudge/external/101/10107.html
 *
 * @author  Jonhnny Weslley
 * @version 1.00, 19/10/2008
 */
@Problem(Status.Accepted)
public class WhatIsTheMedian {

	public static void main(String[] args) throws IOException {
		List<Long> numbers = new LinkedList<Long>();
		StringBuilder out = new StringBuilder();
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n;
		long median, value;
		String line;
		while ((line = in.readLine()) != null) {
			value = Long.valueOf(line.trim());
			numbers.add((abs(binarySearch(numbers, value)) - 1), value);

			if (numbers.size() % 2 == 0) {
				n = numbers.size() / 2;
				median = (numbers.get(n--) + numbers.get(n)) / 2;
			} else {
				median = numbers.get(numbers.size() / 2);
			}
			out
			.append(median)
			.append('\n');
		}
		System.out.print(out);
	}

}
